home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / NRLIBE32.ZIP / NRLIB32.H < prev    next >
Text File  |  1994-11-23  |  31KB  |  540 lines

  1. /******************************************************************************/
  2. /*                                                                            */
  3. /*            ROUTINES FOR MULTIPLE NEURAL NETWORKS MANAGEMENT                */
  4. /*       (routines for ERROR BACK PROPAGATION training are included)          */
  5. /*                                                                            */
  6. /*                      Version  3.2 (32 bits/16 bits)                        */
  7. /*                       Copyright by Daniele Denaro                          */
  8. /******************************************************************************/
  9.  
  10. /* Switch depending on hardware and compilators */
  11. /* B16 (DOS ) B32 (DOS 32 bits ,UNIX etc.) */
  12.  
  13. # define B16                      /* modify depending on hardware or compil.  */
  14.  
  15. /******************************************************************************/
  16. /*                                                                            */
  17. /*  Abstract of library   functionalities :                                   */
  18. /*     - Nets create   in memory ; one or more nets different too             */
  19. /*     - Save and load all nets on/from file                                  */
  20. /*     - Net compute (input propagate)                                        */
  21. /*     - Net training with  EBP (Error Back Propagation)                      */
  22. /*                                                                            */
  23. /*  Each net can have any number of layers .                                  */
  24. /*                                                                            */
  25. /*  Each layer can have any number of nodes .                                 */
  26. /*                                                                            */
  27. /*  Each node can have any number of links with others nodes .                */
  28. /*                                                                            */
  29. /*  Nodes are automatically numbered with progressive number in net .         */
  30. /*                                                                            */
  31. /*  One can choose a different activation function for each node. There are   */
  32. /*  ten types of activation function : 6 defined and 3 for user definition.   */
  33. /*  For each node it's also possible to define another function, named action,*/
  34. /*  which is called after the activation function.                            */
  35. /*                                                                            */
  36. /*                                                                            */
  37. /*  Range of principals values                                                */
  38. /*                                                                            */
  39. /*  Maximum values:                                                           */
  40. /*                                                                            */
  41. /*     - Maximum net number     : 1000 (in this release)                      */
  42. /*     - Maximum layer number   : 99  (in  a  net)                            */
  43. /*     - Maximum node number    : 7FFFFFFF(hex) (in a net)                    */
  44. /*                                                                            */
  45. /*  Minimum values:                                                           */
  46. /*                                                                            */
  47. /*     - First net              : 1                                           */
  48. /*     - First layer in a net   : 0 (input layer)                             */
  49. /*     - First node  in a net   : 1                                           */
  50. /*                                                                            */
  51. /*                                                                            */
  52. /******************************************************************************/
  53.  
  54. /******************************************************************************/
  55. /*                                                                            */
  56. /*   Neural network architecture:                                             */
  57. /*                                                                            */
  58. /*                                                                            */
  59. /*   Network m                                                                */
  60. /*             /|\                                                            */
  61. /*   Layer n    |                                                             */
  62. /*       ---------------            Each layer is automatically linked with   */
  63. /*             /|\                  next layer and all nodes of layer i are   */
  64. /*              |                   linked with all nodes of layer i+1.       */
  65. /*    ----------------------                                                  */
  66. /*              :                   Network creation :                        */
  67. /*              :                   - by function <createnet> ;               */
  68. /*              :                     we however need to define the structure */
  69. /*   Layer 1    :                     of all nets list,first by <createstruct>*/
  70. /*    ----------------------          This structure can be defined if we know*/
  71. /*             /|\                    the total number of nets and the maximum*/
  72. /*   Layer 0    |                     layer number for each net.              */
  73. /*     --------------------         - it's also possible to define the struct.*/
  74. /*             /|\                    of net list and all nets in the same    */
  75. /*              |                     time,by the function <creteallnet> , if */
  76. /*                                    the nets have the same size.            */
  77. /*                                  - we can save or load all nets by function*/
  78. /*                                    <savenet> or <loadnet> .                */
  79. /*   Layer i                          That  functions are relative to all nets*/
  80. /*             /|\                    but the total number of nets can be     */
  81. /*   Node k     |                     reduced by the function <wmnet>.        */
  82. /*    +-------------------+           Nets loading doesn't need structure of  */
  83. /*    |       status      |           nets list and overwrite it if exist.    */
  84. /*    |--activ. function--|.......                                            */
  85. /*    |        inp        |                                                   */
  86. /*    +-------------------+                                                   */
  87. /*             /|\                  Other warning on creation functions:      */
  88. /*              |                   for default , weights are initialised with*/
  89. /*                                  a random value between -.4 and +.4, and   */
  90. /*                                  bias for all nodes are 0.                 */
  91. /*                                                                            */
  92. /*                                                                            */
  93. /*                                                                            */
  94. /* Warning:                                                                   */
  95. /*    although the library is optimized for simple forward networks, it's     */
  96. /*    possible create and manage very complex network using functions for     */
  97. /*    single node or single layer.                                            */
  98. /*    Version 4 was implemented for optimize manage for complex network       */
  99. /*    (ie. complex layers links, contest memory, recursive link etc.)         */
  100. /******************************************************************************/
  101.  
  102. /******************************************************************************/
  103. /*                                                                            */
  104. /*   Net elaboration and training                                             */
  105. /*                                                                            */
  106. /*   Forward propagation:                                                     */
  107. /*                                                                            */
  108. /*   Basic function is <propagate> ; this function forward propagate net from */
  109. /*   layer A to layer  B.                                                     */
  110. /*   For each node of a layer the activation function is calculated on input  */
  111. /*   value and result (status of activation) is added at input of pointed node*/
  112. /*   after scaling by weight factor.                                          */
  113. /*                                                                            */
  114. /*   The function <compute> is more general; she call previous function       */
  115. /*   between first and last layer. We have to supply input values and after   */
  116. /*   we can obtain the output values.                                         */
  117. /*                                                                            */
  118. /*   <produce> is the most general function    ; she need file of input values*/
  119. /*   and produce a file of output values.                                     */
  120. /*   Input file format : n-ple of input values (corresp. at n inp. of layer 0)*/
  121. /*                                                                            */
  122. /*                                                                            */
  123. /*   Backward training :                                                      */
  124. /*                                                                            */
  125. /*   Basic function is <backprop> ; this function apply  the EBP rule from    */
  126. /*   layer B to layer A .                                                     */
  127. /*   For each node of a layer the error value is calculated on basis of error */
  128. /*   at next layer and at the same time weigts  are corrected     .           */
  129. /*   At end , error at layer A is loss.                                       */
  130. /*   We can backpropagate only error without weigts correction by function    */
  131. /*   <backproperr> instead of previous function; but in this case we must use */
  132. /*   the function <cancerr> after, because buffers for forward and backward   */
  133. /*   are partially coincident .                                               */
  134. /*   For default bias is not modified , but it's possible  do it by function  */
  135. /*   <param> . By this function it's possible also modify   the learning and  */
  136. /*   moment coefficients (for default 0.8 and 0.5) .                          */
  137. /*                                                                            */
  138. /*   Function <learn> is more general ; she call previous function for all    */
  139. /*   layer of net.                                                            */
  140. /*                                                                            */
  141. /*   <train> is the most general function ; she need the trainer file  and    */
  142. /*   produce average quadratic error. She reed the trainer file for ep times  */
  143. /*   (where ep = 1 for default) .                                             */
  144. /*   Trainer file format : n-pla (input values)   m-pla (exact out values)    */
  145. /*   (where n = nodes at layer 0  , m= nodes at last layer )                  */
  146. /*                                                                            */
  147. /*                                                                            */
  148. /*                                                                            */
  149. /******************************************************************************/
  150.  
  151.  
  152. # ifdef B16
  153. # define far far
  154. # define LONG long
  155. # define CLOCK_PS 18.2
  156. # define ALLOCA farcalloc
  157. # define LIBERA farfree
  158. # include <dos.h>
  159. # include <alloc.h>
  160. # endif
  161.  
  162. # ifdef B32
  163. # define far
  164. # define LONG  int
  165. # define ALLOCA calloc
  166. # define LIBERA free
  167. # define CLOCK_PS 100
  168. # endif
  169.  
  170.  
  171. # define MAX_RAND 0x7FFF
  172.  
  173. # define NULLO 0
  174.  
  175. /*************************  FUNCTIONS DECLARATIONS **************************/
  176.  
  177. int   loadnet(char *fileinp);
  178.             /* Load all networks from file <fileinp> to memory  */
  179.             /* In the same time create structure for nets list  */
  180.             /* Par. inp.: fileinp (file name)                   */
  181.             /*            if fileinp="" default = nnetsinp.dat  */
  182.  
  183. int   savenet(char *fileout);
  184.             /* Save all networks from memory to file <fileout>  */
  185.             /* Par. inp.: fileout (file name)                   */
  186.             /*            if fileout="" default = nnetsout.dat  */
  187.  
  188. int   createallnet(int tn,int nlay,LONG vn[],char vf[][10],char va[][10]);
  189.             /* Create <tn> same nets in memory and the structure*/
  190.             /* that describe them.                              */
  191.             /* Links between layers are wholes and the weight   */
  192.             /* are initialized with a value between ra=-.4 and  */
  193.             /* rb=+.4 (see function <param> for ra and rb def.) */
  194.             /* Par. inp.:tn   (total nets)                      */
  195.             /*           nliv (max layer)                       */
  196.             /*           vn[] (array of tot. nodes for each lay)*/
  197.             /*           vf[] (array of a.fun name for each lay)*/
  198.             /*           va[] (array of act. name for each lay) */
  199.  
  200. int   createstruct(int tn,int vlay[]);
  201.             /* Create the structure that describe list of all   */
  202.             /* networks. We need create this before create      */
  203.             /* single net.                                      */
  204.             /* It is possible to define nets with different lay */
  205.             /* Par. inp.: tn     (total nets )                  */
  206.             /*            vlay[] (array of max lay for each net)*/
  207.  
  208. int   createnet(int net,LONG vn[],char vf[][10],char va[][10]);
  209.             /* Create single net .                              */
  210.             /* (structure of nets list must already exist)      */
  211.             /* We can define total nodes , activation function  */
  212.             /* and action for each layer of net.                */
  213.             /* Par. inp.: net   (net number or id)              */
  214.             /*            vn[]  (array of total nodes for lay)  */
  215.             /*            vf[]  (array of a.fun. name for lay)  */
  216.             /*            va[]  (array of act. name for lay)    */
  217.  
  218. int   ininet(int net);
  219.             /* Overwrite weigts with random number between <ra> */
  220.             /* and <rb> (see function <param> )                 */
  221.             /* Par. inp.: net   (net number)                    */
  222.  
  223. int   copynet(int nta,int ntb);
  224.             /* Copy net A to net B .                            */
  225.             /* Warning: because the function sequencialy copy   */
  226.             /* characteristics from    A nodes to B nodes, if   */
  227.             /* A e B nets are not the same the result can be    */
  228.             /* unpredictible .                                  */
  229.             /* Par. inp.: nta   (net A )                        */
  230.             /*            ntb   (net B )                        */
  231.  
  232. int   cancnets();
  233.             /* Dealloc memory for all nets and structure        */
  234.  
  235.  
  236. int   param(char *name, char *val);
  237.             /* Modify global parameters     .                   */
  238.             /* Parameters names :                               */
  239.             /* ne (epochs number for   EBP;           def. 1)   */
  240.             /* er (min q. error for stop EBP;         def. 0)   */
  241.             /* ep (learning coefficient for EBP;      def. 0.8) */
  242.             /* mo (momentum coefficient for EBP;      def. 0.5) */
  243.             /* ra (weigts random gener. start value ; def.-0.4) */
  244.             /* rb (weigts random gener. end value   ; def. 0.4) */
  245.             /* fb (flag bias training; 1=yes        ; def. 0)   */
  246.             /* fd (flag verbose    ;                  def. 1)   */
  247.             /* Par. inp.: name  (param. name)                   */
  248.             /*            val   (ascii value)                   */
  249.  
  250. int   produce(int net,char *finpdat, char *foutdat);
  251.             /* The most general function for net forward        */
  252.             /* computation.                                     */
  253.             /* Read input values(of layer 0) from file <finpdat>*/
  254.             /* and write output values(of last layer) on file   */
  255.             /* <foutdat>.                                       */
  256.             /* (function <produce> call function <compute>)     */
  257.             /* Par. inp.: net     (net number)                  */
  258.             /*            finpdat (input file name)             */
  259.             /*                     if *finpdat = "" def.= stdinp*/
  260.             /*            foutdat (output file name)            */
  261.             /*                     if *foutdat = "" def.= stdout*/
  262.  
  263.   float compute(int net,float vinp[],float vout[],float vdat[]);
  264.             /* Forward computation for a net.                   */
  265.             /* Read input values (of layer 0) from the array    */
  266.             /* <vinp>  ,  write output values (of last layer)   */
  267.             /* on the array <vout> and compare <vout> with      */
  268.             /* <vdat> values (expected values) , at last, over- */
  269.             /* write <vdat> with error (for next EBP phase).    */
  270.             /* Warning: vinp[1] is input for first node of lay 0*/
  271.             /* and vout[1] is status of first node of last layer*/
  272.             /* Return value is the average quadratic error for  */
  273.             /* output nodes .                                   */
  274.             /* (function <compute> call function <propagate>)   */
  275.             /* Par. inp.: net    (net number)                   */
  276.             /*            vinp[] (array of input data)          */
  277.             /*            vdat[] (array of out expected  )      */
  278.             /* Par. out.: vout[] (array of out data)            */
  279.             /*            vdat[] (array of out errors)          */
  280.             /* Return   : average q. error                      */
  281.  
  282.     int   propagate(int net,int laya,int layb);
  283.             /* Propagate input from layer A to layer B          */
  284.             /* Par. inp.: net  (net number)                     */
  285.             /*            laya (layer numer)                    */
  286.             /*            layb (layer number)                   */
  287.  
  288. float train(int net,char *filetrain);
  289.             /* The most general function for EBP training.      */
  290.             /* Read couple of values for input nodes and output */
  291.             /* expected values from file <*filetrain>, and      */
  292.             /* modify weigts applying EBP rule .                */
  293.             /* The function has 2 phases : first call <compute> */
  294.             /* to propagate input and after call <learn> to     */
  295.             /* apply EBP rule.                                  */
  296.             /* Training is repeated for <ne> cycles (see <param>*/
  297.             /* (function <train> call <compute> and <learn> )   */
  298.             /* Par. inp.: net  (net number)                     */
  299.             /*            filetrain (file trainer name)         */
  300.             /*                if *filetrain="" def.=nettrain.dat*/
  301.             /* Return   : total averege q. error                */
  302.  
  303.   int   learn(int net,float verr[]);
  304.             /* Function for net EBP training.                   */
  305.             /* Read error  values (out computed - out expected) */
  306.             /* from array <verr> and apply EBP rule at whole   */
  307.             /* net,backpropagating error and modifying weigts . */
  308.             /* Warning: verr[1] is error of first node of last  */
  309.             /* layer.                                           */
  310.             /* (function <learn> call function <backprop>)      */
  311.             /* Par. inp.: net    (net number)                   */
  312.             /*            verr[] (errors array)                 */
  313.  
  314.     int   backprop(int net,int laya,int layb);
  315.             /* Backpropagate errors and modify weigts from layer*/
  316.             /* B to layer A .                                   */
  317.             /* We must write errors buffers of layer B before   */
  318.             /* to call this function (see function <werrl>)     */
  319.             /* Par. inp.: net  (net number)                     */
  320.             /*            laya (layer number  )                 */
  321.             /*            layb (layer number    )               */
  322.  
  323. int  backproperr(int net,int laya,int layb);
  324.             /* Backpropagate errors but don't modify weigts .   */
  325.             /* Warning: this function don't clear errors buffers*/
  326.             /* Par. inp.: net  (net number)                     */
  327.             /*            laya (layer number)                   */
  328.             /*            layb (layer number)                   */
  329.  
  330. int  cancerr(int net,int laya,int layb);
  331.             /* Clear errors buffers.                            */
  332.             /* We must call this function after <backproperr>   */
  333.             /* because errors buffers are partialy utilized by  */
  334.             /* forward propagation.                             */
  335.             /* Par. inp.: net  (net number)                     */
  336.             /*            laya (layer number)                   */
  337.             /*            layb (layer number)                   */
  338.  
  339.  
  340. /******************* Functions for single node  or layer *********************/
  341.  
  342. /* In this functions <net> is net number and <nn> is node number            */
  343.  
  344. /* Warn.: we can dinamicaly modify max layer number or total node link,but  */
  345. /*        only reducing the initial values.                                 */
  346.  
  347. /* Net functions                                                            */
  348.  
  349. int   rmnet(int *totnet);
  350.             /* Read max net number   (total nets)               */
  351.  
  352. int   wmnet(int totnet);
  353.             /* Reduce total nets                                */
  354.  
  355. int   rmlay(int net,int *mlay);
  356.             /* Read max layer number of a net                   */
  357.  
  358. int   totnn(int net, LONG *tnode);
  359.             /* Read total node number of a net                  */
  360.  
  361. int   wmlay(int net,int mlay);
  362.             /* Reduce max layer number of a net                 */
  363.  
  364. int   rlay(int net,int nlay,LONG *sn,LONG *en);
  365.             /* Read start and end node number of a layer        */
  366.  
  367. /* Next 12 functions are dedicated to layer nodes management in groups.     */
  368. /* Therefore I/O buffer is an array ; first element is alwais [1] (not [0]).*/
  369. /* If the array dimension is < than we need, return value is -1 , but       */
  370. /* element are readed or writed as possible.                                */
  371. /* (<nlay..> is the layer number,  <dim> is the array dimension of buffer)  */
  372.  
  373. int   rstatl(int net,int nlay,float stat[],int dim);
  374.             /* Read nodes status of layer <nlay> to array <stat>*/
  375.  
  376. int   wstatl(int net,int nlay,float stat[],int dim);
  377.             /* Modify nodes status of layer <nlay> from <stat>  */
  378.  
  379. int   rinpl(int net,int nlay,float inp[],int dim);
  380.             /* Read nodes inp of layer <nlay> to array <inp>    */
  381.  
  382. int   winpl(int net,int nlay,float inp[],int dim);
  383.             /* Modify nodes inp of layer <nlay> from <inp> val. */
  384.  
  385. int   rerrl(int net,int nlay,float err[],int dim);
  386.             /* Read backprop. error at layer <nlay> to <err>    */
  387.  
  388. int   werrl(int net,int nlay,float err[],int dim);
  389.             /* Modify error buffer at layer <nlay> from <err>   */
  390.  
  391. int   rbiasl(int net,int nlay,float bias[],int dim);
  392.             /* Read nodes bias of layer <nlay> to array <bias>  */
  393.  
  394. int   wbiasl(int net,int nlay,float bias[],int dim);
  395.             /* Modify nodes bias of layer <nlay> from <bias>    */
  396.  
  397. int   rwgtl(int net,LONG nn,int nlayp,float wgt[],int dim);
  398.             /* Read weigts of node <nn> linked with lay <nlayp> */
  399.  
  400. int   wwgtl(int net,LONG nn,int nlayp,float wgt[],int dim);
  401.             /* Modify weigts of node <nn> linked with <nlayp>   */
  402.  
  403. int   rwgtil(int net,LONG npp,int nlaya,float wgt[],int dim);
  404.             /* Read weigts of links at node <npp> from <nlaya>  */
  405.  
  406. int   wwgtil(int net,LONG npp,int nlaya,float wgt[],int dim);
  407.             /* Modify weigts of links at node <npp> from <nlaya>*/
  408.  
  409. /* Single node functions                                                    */
  410.  
  411. int   rstat(int net,LONG nn,float *stat);
  412.             /* Read node activation status                      */
  413.  
  414. int   rbias(int net,LONG nn,float *bias);
  415.             /* Read node bias                                   */
  416.  
  417. int   rinp(int net,LONG nn,float *inp);
  418.             /* Read node input                                  */
  419.  
  420. int   rerr(int net,LONG nn,float *err);
  421.             /* Read node error in EBP phase                     */
  422.  
  423. int   rfun(int net,LONG nn,char fun[10],char ac[10]);
  424.             /* Read function and action names of a node         */
  425.  
  426. int   wstat(int net,LONG nn,float stat);
  427.             /* Modify node activation status                    */
  428.  
  429. int   winp(int net,LONG nn,float inp);
  430.             /* Modify node input                                */
  431.  
  432. int   werr(int net,LONG nn,float err);
  433.             /* Modify node error in EBP phase                   */
  434.  
  435. int   wbias(int net,LONG nn,float bias);
  436.             /* Modify node bias                                 */
  437.  
  438. int   wfun(int net,LONG nn,char fun[10],char ac[10]);
  439.             /* Modify node function and action                  */
  440.  
  441. int   rnconn(int net,LONG nn,LONG *ncl);
  442.             /* Read total number of links                       */
  443.  
  444. int   rconn(int net,LONG nn,LONG cl,float *wgt ,LONG *np);
  445.             /* Read node pointed and weigt of <cl> link         */
  446.             /* (Warn.: links for a node are numbered from 0 )   */
  447.  
  448. int   wwgt(int net,LONG nn,LONG cl,float wgt);
  449.             /* Modify weigt of <cl> link                        */
  450.             /* (Warn.: links for a node are numbered from 0 )   */
  451.  
  452. int   wnodp(int net,LONG nn,LONG cl,LONG np);
  453.             /* Modify node pointed by <cl> link                 */
  454.             /* (Warn.: links for a node are numbered from 0 )   */
  455.  
  456. int   wnconn(int net,LONG nn,LONG ncl);
  457.             /* Modify the total number of links                 */
  458.             /* (Warn.: links for a node are numbered from 0 )   */
  459.             /* (Warn.: we can only reduce total original links) */
  460. /*****************************************************************************/
  461.  
  462. /********************* ACTIVATION FUNCTIONS NAMES ****************************/
  463. /*                                                                            */
  464. /*   f1  : Unitary function : copy input to activation status                 */
  465. /*   f2  : Same as f1 but with memory : add 1/2 previous status to input      */
  466. /*   f3  : Sigmoid function with positiv and negativ value (0 centred)        */
  467. /*   f4  : Same as f3 but with memory                                         */
  468. /*   f5  : Sigmoid function with only positiv value (.5 centred)              */
  469. /*   f6  : Same as f5 but with memory                                         */
  470. /*                                                                            */
  471. /*   f7  : User defined (see below)                                           */
  472. /*   f8  : User defined (see below)                                           */
  473. /*   f9  : User defined (see below)                                           */
  474. /*   f10 : User defined (see below)                                           */
  475. /*                                                                            */
  476. /*   f13 : Sigmoid function as f3 but calculated (more exact but slower )     */
  477. /*   f15 : Sigmoid function as f5 but calculated (more exact but slower )     */
  478. /*                                                                            */
  479. /*   Warning :                                                                */
  480. /*   Sigmoid funct.(f3<->f6) and derivatives are founded  by look table (for  */
  481. /*   more speed) with .01 resolution.                                         */
  482. /******************************************************************************/
  483.  
  484. /*********************** ACTIONS AND USER DEFINED FUNCTION ********************/
  485.  
  486.  int  a1(int net,LONG nn){}
  487.  int  a2(int net,LONG nn){}
  488.  int  a3(int net,LONG nn){}
  489.  int  a4(int net,LONG nn){}
  490.  int  a5(int net,LONG nn){}
  491.  int  a6(int net,LONG nn){}
  492.  
  493.  int  f7(int net,LONG nn,int f,float *d) {}
  494.  int  f8(int net,LONG nn,int f,float *d) {}
  495.  int  f9(int net,LONG nn,int f,float *d) {}
  496.  int  f10(int net,LONG nn,int f,float *d) {}
  497.  
  498. /* Parameters definition :                                                    */
  499. /*            net  : net number                                               */
  500. /*            nn   : node number                                              */
  501. /*            f    : flag function/derivative (0 func. , 1 der. for EBP phase)*/
  502. /*            *d   : buffer for return value of derivative                    */
  503.  
  504. /* Example of user definited function (unitary function):                     */
  505. /*                                                                            */
  506. /* f7(int net,LONG nn, int f, float *d)                                       */
  507. /*  {float buff;                                                              */
  508. /*   if (f==0) {rinp(net,nn,&buff);wstat(net,nn,buff);winp(net,nn,0);return;} */
  509. /*   if (f==1) {*d =1;return;}                                                */
  510. /*  }                                                                         */
  511. /******************************************************************************/
  512.  
  513.  
  514.  
  515. /******************************************************************************/
  516. /*                   Nets saving and loading                                  */
  517. /*                                                                            */
  518. /* File format of nets saved  :                                               */
  519. /*                                                                            */
  520. /*                                                                            */
  521. /* first record : "totnets"/max_net_num/total_layers/                         */
  522. /* other record : "nnet"/net_num/total_nodes/total_links/                     */
  523. /*           or : "lay"/layer_num/                                            */
  524. /*           or : "node"/node_num/input/bias/stat/fun_name/ac_name/           */
  525. /*           or : "conn"/pointed_node;weight/...../pointed_node;weight/       */
  526. /* example :                                                                  */
  527. /*                totnets/10/300/                                             */
  528. /*                  nnet/1/12/36/                                             */
  529. /*                   lay/0/                                                   */
  530. /*                    node/1/0/0/0/f1/0/                                      */
  531. /*                    conn/10;0.66/11;0.3331/12;0.001/                        */
  532. /*                        :                                                   */
  533. /*                        :                                                   */
  534. /*                                                                            */
  535. /* - it's possible to continue record on more lines                           */
  536. /* - each field end with / character                                          */
  537. /* - input,bias,status,weigt are float , other integer                        */
  538. /* - fun_name and ac_name are strings                                         */
  539. /******************************************************************************/
  540.